/**
 * \brief  Client-side pd session interface
 * \author Christian Helmuth
 * \date   2006-07-12
 */

/*
 * Copyright (C) 2006-2009 Christian Helmuth
 * Genode Labs, Feske & Helmuth Systementwicklung GbR
 *
 * This file is part of the Genode OS framework, which is distributed
 * under the terms of the GNU General Public License version 2.
 */

#ifndef _INCLUDE__PD_SESSION__CLIENT_H_
#define _INCLUDE__PD_SESSION__CLIENT_H_

#include <pd_session/capability.h>
#include <base/ipc.h>
#include <base/lock.h>

namespace Genode {

	class Pd_session_client : public Pd_session
	{
		private:

			Msgbuf<256> _snd_msg, _rcv_msg;
			Ipc_client  _ipc_client;
			Lock        _lock;

		public:

			explicit Pd_session_client(Pd_session_capability session)
			: _ipc_client(session, &_snd_msg, &_rcv_msg) { }

			int bind_thread(Thread_capability thread)
			{
				Lock::Guard lock_guard(_lock);
				return (_ipc_client << BIND_THREAD << thread << IPC_CALL);
			}
	};
}

#endif /* _INCLUDE__PD_SESSION__CLIENT_H_ */
